<template>
  <div class="users-container">
    <h1>用户列表</h1>
    <el-table :data="users" style="width: 100%">
      <el-table-column prop="id" label="ID" width="80" />
      <el-table-column prop="name" label="用户名" width="180" />
      <el-table-column prop="email" label="邮箱" width="180" />
      <el-table-column prop="regDate" label="注册日期" />
      <el-table-column label="操作">
        <template #default="scope">
          <el-button type="text" size="small" @click="handleDetail(scope.row)">查看</el-button>
          <el-button type="text" size="small" @click="handleEdit(scope.row)">编辑</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script setup>
import { ref } from 'vue';
import { ElMessage } from 'element-plus';

// Mock user data
const users = ref([
  {
    id: 1,
    name: '张三',
    email: 'zhangsan@example.com',
    regDate: '2023-05-20'
  },
  {
    id: 2,
    name: '李四',
    email: 'lisi@example.com',
    regDate: '2023-05-21'
  },
  {
    id: 3,
    name: '王五',
    email: 'wangwu@example.com',
    regDate: '2023-05-22'
  }
]);

const handleDetail = (row) => {
  ElMessage.info(`查看用户: ${row.name}`);
};

const handleEdit = (row) => {
  ElMessage.info(`编辑用户: ${row.name}`);
};
</script>

<style scoped>
.users-container {
  padding: 20px;
}
</style> 